#include "gtest/gtest.h"
#include "WeightedGraph.h"


TEST(graph1,construction_deletion) {
	WeightedGraph<double> graph(3);
	EXPECT_EQ(100000,graph.getArc(0,0));
	EXPECT_EQ(100000,graph.getArc(2,2));
}

TEST(graph1, add_vertex){
	WeightedGraph<double>* graph = new WeightedGraph<double>(3);
	graph->addVertex(100);
	EXPECT_EQ(103,graph->getSize());
	delete graph;	
}

TEST(graph1, add_get_arc){
	WeightedGraph<double>* graph = new WeightedGraph<double>(3);
	graph->addArc(0, 0, 3);
	EXPECT_EQ(3,graph->getArc(0,0));
	delete graph;	
}

TEST(graph1, get_shortest_ranges){
	WeightedGraph<double>* graph = new WeightedGraph<double>(4);
	graph->addArc(0, 1, 3);
	graph->addArc(1, 2, 4);
	graph->addArc(2, 1, 5);
	graph->addArc(1, 0, 5);

	matrix<double>* matr = graph->get_shortest_ranges();

	EXPECT_EQ(3,(*matr)(0,1));
	EXPECT_EQ(7,(*matr)(0,2));
	EXPECT_EQ(10,(*matr)(2,0));
	EXPECT_EQ(100000,(*matr)(3,0));

	delete matr;
	delete graph;	
}


int main(int argc, char **argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}
